package com.starhub.application.rag.enums;

/**
 * 元数据解析类型
 * @version: V1.0
 * @author: liuhf
 * @time 2025-06-30
 */
public enum MetaDataTypeEnums {
    DATABASE(1, "数据库查询"),
    METALINK(2, "元数据关联");

    private Integer code;

    private String name;

    public Integer getCode() {
        return code;
    }   

    public String getName() {
        return name;
    }
    
    MetaDataTypeEnums(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据code获取
     * @param code
     * @return
     */
    public static MetaDataTypeEnums getMetaDataType(Integer code) {
        if (code == null) {
            return null;
        }
        for (MetaDataTypeEnums metaDataType : values()) {
            if (metaDataType.getCode().equals(code)) {
                return metaDataType;
            }
        }
        return null;
    }
}
